﻿using System;
using System.Collections.Generic;
using System.Drawing.Design;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;
using Microsoft.Practices.Modeling.ExtensionProvider.Metadata;
using Microsoft.Practices.Services.ItineraryDsl;
using Microsoft.Practices.Modeling.ExtensionProvider.Extension;
using Microsoft.Practices.Modeling.Common;
using Microsoft.Practices.Modeling.Common.Design;
using Microsoft.Practices.Modeling.Services.Design;
using Microsoft.Practices.Modeling.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
using BizTalk.ESB.Extensions.Helpers;

namespace BizTalk.ESB.Extensions.ResolverExtenders
{
    [Serializable]
    [ObjectExtender(typeof(Resolver))]
    public class StaticContextToContentResolverExtender : ObjectExtender<Resolver>
    {
        [Category(StaticServiceProxyRequestResolverExtenderProvider.ExtensionProviderPropertyCategory),
            Description("Xpath for field to populate with value of the SoapMethodName."),
            DisplayName("Received File Name"),
            ReadOnly(false),
            Browsable(true)]
        [XmlElement]
        public String ReceivedFileName { get; set; }

        [Category(StaticServiceProxyRequestResolverExtenderProvider.ExtensionProviderPropertyCategory),
            Description("Xpath for field to populate with value of the SoapMethodName."),
            DisplayName("Message ID"),
            ReadOnly(false),
            Browsable(true)]
        [XmlElement]
        public String MessageID { get; set; }

        [Category(StaticServiceProxyRequestResolverExtenderProvider.ExtensionProviderPropertyCategory),
            Description("Xpath for field to populate with value of the SoapMethodName."),
            DisplayName("Message Type"),
            ReadOnly(false),
            Browsable(true)]
        [XmlElement]
        public String MessageType { get; set; }

        [Category(StaticServiceProxyRequestResolverExtenderProvider.ExtensionProviderPropertyCategory),
            Description("Xpath for field to populate with value of the SoapMethodName."),
            DisplayName("Receive Port Name"),
            ReadOnly(false),
            Browsable(true)]
        [XmlElement]
        public String ReceivePortName { get; set; }

        [Category(StaticServiceProxyRequestResolverExtenderProvider.ExtensionProviderPropertyCategory),
            Description("Xpath for field to populate with value of the SoapMethodName."),
            DisplayName("Correlation Token"),
            ReadOnly(false),
            Browsable(true)]
        [XmlElement]
        public String CorrelationToken { get; set; }

        [Category(StaticServiceProxyRequestResolverExtenderProvider.ExtensionProviderPropertyCategory),
            Description("Xpath for field to populate with value of the SoapMethodName."),
            DisplayName("Interchange ID"),
            ReadOnly(false),
            Browsable(true)]
        [XmlElement]
        public String InterchangeID { get; set; }

        [Category(StaticServiceProxyRequestResolverExtenderProvider.ExtensionProviderPropertyCategory),
            Description("Xpath for field to populate with value of the SoapMethodName."),
            DisplayName("Itinerary Name"),
            ReadOnly(false),
            Browsable(true)]
        [XmlElement]
        public String ItineraryName { get; set; }

        [Category(StaticServiceProxyRequestResolverExtenderProvider.ExtensionProviderPropertyCategory),
            Description("Xpath for field to populate with value of the SoapMethodName."),
            DisplayName("WCF Action"),
            ReadOnly(false),
            Browsable(true)]
        [XmlElement]
        public String WcfAction { get; set; }

        [Category(StaticServiceProxyRequestResolverExtenderProvider.ExtensionProviderPropertyCategory),
            Description("Xpath for field to populate with value of the SoapMethodName."),
            DisplayName("Soap Method Name"),
            ReadOnly(false),
            Browsable(true)]
        [XmlElement]
        public String SoapMethodName { get; set; }
    }

    [Serializable]
    [ObjectExtender(typeof(Resolver))]
    public class BreContextToContentResolverExtender : ObjectExtender<Resolver>
    {
        [EditorOutputProperty("Version", "Version", new String[] { }),
            Category("Extender Settings"),
            Description("Specifies the policy"),
            DisplayName("Policy"),
            ReadOnly(false),
            Browsable(true),
            Editor(typeof(BiztalkPolicyEditor), typeof(UITypeEditor)),
            TypeConverter(typeof(TypeConverter))]
        public String Policy { get; set; }

        [ReadOnly(false),
            DisplayName("Version"),
            Category("Extender Settings"),
            Description("Specifies the policy version"),
            Browsable(true)]
        public VersionNumber Version { get; set; }

        [Description("Used to recognize the Document Type.  Note: This is a messaging only scenario and is not suppored for Orchestration. i.e. - in case of orchestration, the field will always be set to 'false'."),
            DisplayName("Recognize Message Format"),
            Browsable(true),
            ReadOnly(false),
            Category("Extender Settings")]
        public Boolean RecognizeMessageFormat { get; set; }

        [Description("Determines if the message will be sent to the policy as a fact."),
            ReadOnly(false),
            Browsable(true),
            Category("Extender Settings"),
            DisplayName("UseMsg")]
        public Boolean UseMsg { get; set; }
    }
}
